#include <iostream>
#include <string>
#include <unordered_set>

using namespace std;


int main()
{
    string S, T;
    cin >> S >> T;
    unordered_set<char> t_chars(T.begin(), T.end());

    bool valid = true;

    for(int i = 1; i < S.size(); ++i)
    {
        if(isupper(S[i]))
        {
            if(t_chars.find(S[i - 1]) == t_chars.end()) // t中没有S[i-1]
            {
                valid = false;
                break;
            }
        }
    }
    cout << (valid ? "Yes" : "No") << endl;

    return 0;
}